<?php

	// Head
	require_once '../framework/header.inc.php';
	require_once '../framework/builder/book.class.php';

	define('ID', $_GET['id']);
	
	
	// Set default page structure
	$extended['left'] = "navigation:sections,accordions:booktree:fromauthor:readmore:favorites";
	$extended['content:clearer'] = "path,bookparts,booktitle,bookcontent,chapters";
	$page->constructor("default",$extended);
	
	
	// Set page scripts
	$style['jquery'] = array("jquery.tipsy.css");
	$page->setStyle($style);

	// Set page scripts
	$script['jquery'] = array("jquery.js", "jquery.accordion.js","jquery.tipsy.js");
	$extended = $page->loadFile("scripts/jquery/jquery.inc.js");
	$page->setScript($script,$extended);
	

	// Set book
	$book = new Book(ID);
	$book->setBook();
	$page->pageTitle($book->book['book_title']);

	// Book content
	$book->setContent($_GET['part'],$page->navigations["activitys"]);
	$book->book['filename'] = $page->url['filename'];
	

	// Page render
	$page->render("CATEGORY",$page->category());
	$page->render("SECTIONS",$page->sections($book->book['book_section_id']));
	$page->render("FOOTMENU",$page->navigation("footmenu",null));
	$page->render("BOOKPARTS",$book->bookParts());
	$page->render("BOOKTREE",$book->tree());
	$page->render("BOOKMENU",$page->navigation("bookmenu"));
	$page->render("FROMAUTHOR",$book->fromAuthor(ID));
	$page->render("READMORE",$book->readMore(ID));
	$page->render("FAVORITES",bookmarks(UID, SID));
	$page->render($book->book);
	$page->render($book->chapter);
	$page->show();
?>